/*
 * Copyright (C) 2011. JiangHongTiao <jjurco.sk_gmail.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package sk.lieskove.jianghongtiao.websearch.document.preprocessing;

/**
 * Created by: xjuraj
 * Date: 10/11/11
 * Time: 5:55 PM
 */
public enum SupportedMimeTypes {

    //Microsoft office
    application_msword("application/msword"),
    application_vnd_ms_word("application/vnd.ms-word"),
    application_vnd_openxmlformats_officedocument_wordprocessingml_document("application/vnd.openxmlformats-officedocument.wordprocessingml.document"),
    application_vnd_openxmlformats_officedocument_wordprocessingml_template("application/vnd.openxmlformats-officedocument.wordprocessingml.template"),
    application_vnd_ms_word_document_macroEnabled_12("application/vnd.ms-word.document.macroEnabled.12"),
    application_vnd_ms_word_template_macroEnabled_12("application/vnd.ms-word.template.macroEnabled.12"),
    application_vnd_ms_excel("application/vnd.ms-excel"),
    application_vnd_openxmlformats_officedocument_spreadsheetml_sheet("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"),
    application_vnd_openxmlformats_officedocument_spreadsheetml_template("application/vnd.openxmlformats-officedocument.spreadsheetml.template"),
    application_vnd_ms_excel_sheet_macroEnabled_12("application/vnd.ms-excel.sheet.macroEnabled.12"),
    application_vnd_ms_excel_template_macroEnabled_12("application/vnd.ms-excel.template.macroEnabled.12"),
    application_vnd_ms_excel_addin_macroEnabled_12("application/vnd.ms-excel.addin.macroEnabled.12"),
    application_vnd_ms_excel_sheet_binary_macroEnabled_12("application/vnd.ms-excel.sheet.binary.macroEnabled.12"),
    application_vnd_ms_powerpoint("application/vnd.ms-powerpoint"),
    application_vnd_openxmlformats_officedocument_presentationml_presentation("application/vnd.openxmlformats-officedocument.presentationml.presentation"),
    application_vnd_openxmlformats_officedocument_presentationml_template("application/vnd.openxmlformats-officedocument.presentationml.template"),
    application_vnd_openxmlformats_officedocument_presentationml_slideshow("application/vnd.openxmlformats-officedocument.presentationml.slideshow"),
    application_vnd_ms_powerpoint_addin_macroEnabled_12("application/vnd.ms-powerpoint.addin.macroEnabled.12"),
    application_vnd_ms_powerpoint_presentation_macroEnabled_12("application/vnd.ms-powerpoint.presentation.macroEnabled.12"),
    application_vnd_ms_powerpoint_template_macroEnabled_12("application/vnd.ms-powerpoint.template.macroEnabled.12"),
    application_vnd_ms_powerpoint_slideshow_macroEnabled_12("application/vnd.ms-powerpoint.slideshow.macroEnabled.12"),
    application_visio("application/visio"),
    application_x_visio("application/x-visio"),
    application_vnd_visio("application/vnd.visio"),
    application_visio_drawing("application/visio.drawing"),
    application_vsd("application/vsd"),
    application_x_vsd("application/x-vsd"),
    application_vnd_ms_outlook("application/vnd.ms-outlook"),
    application_x_mspublisher("application/x-mspublisher"),
    application_vnd_ms_publisher("application/vnd.ms-publisher"),
    image_x_vsd("image/x-vsd"),
    message_rfc822("message/rfc822"),
    //Open Document Format
    application_vnd_oasis_opendocument_chart("application/vnd.oasis.opendocument.chart"),
    application_vnd_oasis_opendocument_chart_template("application/vnd.oasis.opendocument.chart-template"),
    application_vnd_oasis_opendocument_database("application/vnd.oasis.opendocument.database"),
    application_vnd_oasis_opendocument_formula("application/vnd.oasis.opendocument.formula"),
    application_vnd_oasis_opendocument_formula_template("application/vnd.oasis.opendocument.formula-template"),
    application_vnd_oasis_opendocument_graphics("application/vnd.oasis.opendocument.graphics"),
    application_vnd_oasis_opendocument_graphics_template("application/vnd.oasis.opendocument.graphics-template"),
    application_vnd_oasis_opendocument_image("application/vnd.oasis.opendocument.image"),
    application_vnd_oasis_opendocument_image_template("application/vnd.oasis.opendocument.image-template"),
    application_vnd_oasis_opendocument_presentation("application/vnd.oasis.opendocument.presentation"),
    application_vnd_oasis_opendocument_presentation_template("application/vnd.oasis.opendocument.presentation-template"),
    application_vnd_oasis_opendocument_spreadsheet("application/vnd.oasis.opendocument.spreadsheet"),
    application_vnd_oasis_opendocument_spreadsheet_template("application/vnd.oasis.opendocument.spreadsheet-template"),
    application_vnd_oasis_opendocument_text("application/vnd.oasis.opendocument.text"),
    application_vnd_oasis_opendocument_text_master("application/vnd.oasis.opendocument.text-master"),
    application_vnd_oasis_opendocument_text_template("application/vnd.oasis.opendocument.text-template"),
    application_vnd_oasis_opendocument_text_web("application/vnd.oasis.opendocument.text-web"),
    // PDF/PS documents
    application_x_dvi("application/x-dvi"),
    application_pdf("application/pdf"),
    application_postscript("application/postscript"),
    // (X)HTML/XML
    application_xhtml_xml("application/xhtml+xml"),
    application_xml_dtd("application/xml-dtd"),
    application_xop_xml("application/xop+xml"),
    application_atom_xml("application/atom+xml"),
    application_rss_xml("application/rss+xml"),
    //textual documents
    text_cmd("text/cmd"),
    text_csv("text/csv"),
    text_html("text/html"),
    text_plain("text/plain"),
    text_xml("text/xml"),
    // flash animation
    application_x_shockwave_flash("application/x-shockwave-flash"),
    // RTF Document type
    application_rtf("application/rtf"),
    text_rtf("text/rtf"),
    // when mime type is not supported
    not_supported("NOT SUPPORTED");
    private final String value;

    SupportedMimeTypes(String v) {
        value = v;
    }

    public String value() {
        return value;
    }

    public static SupportedMimeTypes fromValue(String v) {
        for (SupportedMimeTypes c : SupportedMimeTypes.values()) {
            if (c.value.equals(v)) {
                return c;
            }
        }
        return not_supported;
    }

    public boolean containsValue(String v) {
        for (SupportedMimeTypes c : SupportedMimeTypes.values()) {
            if (c.value.equals(v)) {
                return true;
            }
        }
        return false;
    }
}
